﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ExplorerPlus.DomainObjects;
using ExplorerPlus.PersistenceLayer.Sql;

namespace ExplorerPlus.PersistenceLayer
{
    internal class SqlPersistence : IPersistence
    {
        public List<FlyWeightItem> GetFlyWeightCategories()
        {
            return DataAccessFlyWeight.GetAllCategories();
        }

        public List<FlyWeightItem> GetFlyWeightCategoryFields(int categoryId)
        {
            return DataAccessFlyWeight.GetCategoryFields(categoryId);
        }

        public List<FlyWeightItem> GetFlyWeightCategoryFieldItems(int categoryId, int fieldId)
        {
            return DataAccessFlyWeight.GetCategoryFieldItems(categoryId, fieldId);
        }

        public List<FlyWeightItem> GetFlyWeightItems(int categoryId, int fieldId, string fieldValue)
        {
            return DataAccessFlyWeight.GetItems(categoryId, fieldId, fieldValue);
        }

        public Item GetItem(int categoryId, int itemId)
        {
            return DataAccess.GetItem(categoryId, itemId);
        }

        public Plugin GetCategoryPlugins(int categoryId)
        {
            return new Plugin();
        }

        #region IPersistence Members


        public bool SaveItem(Item item)
        {
            DataAccess.AddItem(item);
            return true;
        }

        public void DeleteItem(int categoryId, int itemId)
        {
            throw new NotImplementedException();
        }

        public Item GetItemByName(int categoryId, string itemName)
        {
            throw new NotImplementedException();
        }
        #endregion
    }
}
